package com.woniu.swagger.controller;

import com.woniu.swagger.common.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("hotel")
@Api(tags = "酒店相关接口", description = "提供酒店相关的 Rest API")
public class HotelController {
    @ApiOperation(value ="新增酒店")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "hotelName", value = "酒店名", dataType = "String"),
            @ApiImplicitParam(name = "hotelTel", value = "酒店电话", dataType = "String"),
            @ApiImplicitParam(name = "hotelAddress", value = "酒店地址", dataType = "String"),
            @ApiImplicitParam(name = "hotelLongitude", value = "酒店经度", dataType = "double"),
            @ApiImplicitParam(name = "hotelLatitude", value = "酒店纬度", dataType = "double"),
            @ApiImplicitParam(name = "hotelStatus", value = "酒店状态", dataType = "String"),
            @ApiImplicitParam(name = "hotelComplain", value = "酒店投诉次数", dataType = "int")
    })
    @PostMapping("addHotel")
    public Result addHotel(String hotelName,
                           String hotelTel,
                           String hotelAddress,
                           double hotelLongitude,
                           double hotelLatitude,
                           String hotelStatus,
                           int hotelComplain){
        // 数据持久化
        return Result.success("新增成功");
    }

    @ApiOperation(value ="修改酒店")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "hotelName", value = "酒店名", dataType = "String"),
            @ApiImplicitParam(name = "hotelTel", value = "酒店电话", dataType = "String"),
            @ApiImplicitParam(name = "hotelAddress", value = "酒店地址", dataType = "String"),
            @ApiImplicitParam(name = "hotelLongitude", value = "酒店经度", dataType = "double"),
            @ApiImplicitParam(name = "hotelLatitude", value = "酒店纬度", dataType = "double"),
            @ApiImplicitParam(name = "hotelStatus", value = "酒店状态", dataType = "String"),
            @ApiImplicitParam(name = "hotelComplain", value = "酒店投诉次数", dataType = "int")
    })
    @PostMapping("modifyHotel")
    public Result modifyHotel(String hotelName,
                              String hotelTel,
                              String hotelAddress,
                              double hotelLongitude,
                              double hotelLatitude,
                              String hotelStatus,
                              int hotelComplain){
        // 数据持久化
        return Result.success("修改成功");
    }
}
